import { NgModule } from '@angular/core';
import {CommonModule, LocationStrategy, HashLocationStrategy} from '@angular/common';
import {RouterModule, Routes} from "@angular/router";
import {HomeComponent} from "../modules/home/home.component";
import {AboutComponent} from "../modules/about/about.component";
import {ContactComponent} from "../modules/contact/contact.component";

const routes: Routes = [
  {path: '', redirectTo: 'home', pathMatch: 'full'},
  {path: 'home', component: HomeComponent},
  {path: 'about', component: AboutComponent},
  {path: 'contact', component: ContactComponent},
];
@NgModule({
  imports: [
    CommonModule,
    RouterModule.forRoot(routes)
  ],
  exports:[RouterModule],
  declarations: [],
  providers:[
    {
      provide:LocationStrategy,// 导航路径的策略设置
      useClass: HashLocationStrategy // 使用'#'方式的策略
    }
  ]
})
export class AppRoutingModule { }
